package com.hsteach.web.controller.patrol;

import com.github.pagehelper.PageHelper;
import com.hsteach.common.core.controller.BaseController;
import com.hsteach.common.core.domain.AjaxResult;
import com.hsteach.common.core.page.TableDataInfo;
import com.hsteach.common.utils.PageUtils;
import com.hsteach.dao.domain.patrol.Student;
import com.hsteach.dao.domain.patrol.Teacher;
import com.hsteach.service.patrol.RoleService;
import com.hsteach.web.controller.patrol.dto.QueryStudentDTO;
import com.hsteach.web.controller.patrol.dto.StudentDTO;
import com.hsteach.web.controller.patrol.dto.TeacherDTO;
import com.hsteach.web.controller.patrol.vo.GradeAndClass;
import com.hsteach.web.controller.patrol.vo.TeacherVO;
import com.hsteach.web.dto.PageDto;
import com.hsteach.web.dto.ScoreRolePageDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *
 * </p>
 *
 * @author mgb
 * @version PatrolRoleController, java v1.0 2023-11-08 22:15 EXP $
 */
@Api(value = "巡查角色设置", tags = "巡查角色设置")
@RestController
@RequestMapping("/patrol/role")
public class PatrolRoleController extends BaseController{

    @Autowired
    public RoleService roleService;

    /**
     * 查询值班主表列表
     */
    @ApiOperation("新增学生")
    @PostMapping("/addStudent")
    public AjaxResult addStudent(@RequestBody List<StudentDTO> studentDTOS){

        return success("添加成功",roleService.addStudent(studentDTOS));
    }
    @ApiOperation("移除学生")
    @PostMapping("/deleteStudent")
    public AjaxResult deleteStudent(String studentId){
        return success(roleService.deleteStudent(studentId));
    }

    /**
     * 列表查詢
     */
    @ApiOperation("学生列表查詢")
    @PostMapping("/queryStudentList")
    public TableDataInfo queryStudentList(@RequestBody QueryStudentDTO studentDTO){
        return  roleService.queryStudentList(studentDTO);
    }

    /**
     * 查询值班主表列表
     */
    @ApiOperation("新增教师")
    @PostMapping("/addTeacher")
    public AjaxResult addTeacher(@RequestBody List<TeacherDTO> teacherDTOS){

        return success("添加成功",roleService.addTeacher(teacherDTOS));
    }

    @ApiOperation("查询教师列表")
    @PostMapping("/queryTeacher")
    public TableDataInfo queryTeacher(@RequestBody ScoreRolePageDto dto){

        return  roleService.queryTeacherList(dto);

    }
    @ApiOperation("移除教师")
    @PostMapping("/deleteTeacher")
    public AjaxResult deleteTeacher(String teacherId){
        return success(roleService.deleteTeacher(teacherId));
    }
    @ApiOperation("获取班主任名称和编号")
    @GetMapping("/queryAllTeacher")
    public AjaxResult queryClassTeacher(@RequestParam(name = "classId") String classId){

        return success(roleService.queryClassTeacher(classId));
    }


}
